﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class VideoGallery : System.Web.UI.Page
{
    //static LinkButton[] Lbutton = new LinkButton[100];
    //static int btn_count;

    protected void Page_Load(object sender, EventArgs e)
    {
        string virtualPathDir = Server.MapPath("~/galerijas/"); // atrod virtual path lapas Bāzes MAPI
        string[] dirrAray = Directory.GetDirectories(virtualPathDir); // nolasa visas servera Mapes
        string[] fotoFile = Directory.GetFiles(dirrAray[0]);
        string[] FOlderList = new string[dirrAray.Length];
        //btn_count = fotoFile.Length;
        //string textID = "Lbutton";
        for (int i = 0; i < dirrAray.Length; i++)
        {
            FOlderList[i] = dirrAray[i].Substring(dirrAray[i].LastIndexOf("\\") + 1);
        }
        Repeater1.DataSource =FOlderList;
        Repeater1.DataBind();
    }

    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int MapesNr = e.Item.ItemIndex;
        Response.Redirect("Galery.aspx?value=" + MapesNr);
    }
}